<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
		
 </body>
</html>
<script>
	//排序sort() 会改就原数组
	var arr = ['g', 't', 'c', 'f', 'a', 'd'];
	arr.sort();
	console.log(arr);
	

	//基本排序数字
	var arr1 = [22, 11, 3, 55, 23, 90, 19];
	arr1.sort();
	console.log(arr1); //在计算机里面比较大小，是根据按位来的，11 > 3   1 < 3
	
	//实现真正的数字排序要传一个参数(函数)进去
	arr1.sort(function(a, b){
		return b - a;  //b - a是从大到小，可以a - b从小到大
	});
	console.log(arr1);
</script>
